#ifndef __AUTO_INIT_H
#define __AUTO_INIT_H

#include <stdint.h>
#include <stdio.h>


// 定义自动化函数指针
typedef void (*init_func)(void);

#define INIT_EXPORT(fn, level)                                                 \
  const init_func init_##fn __attribute__((used, section(".init." level))) = fn

/* board init routines will be called in board_init() function */
#define INIT_BOARD_EXPORT(fn) INIT_EXPORT(fn, "1")
/* pre/device/component/env/app init routines will be called in init_thread */
/* components pre-initialization (pure software initilization) */
#define INIT_PREV_EXPORT(fn) INIT_EXPORT(fn, "2")
/* device initialization */
#define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "3")
/* components initialization (dfs, lwip, ...) */
#define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "4")
/* environment initialization (mount disk, ...) */
#define INIT_ENV_EXPORT(fn) INIT_EXPORT(fn, "5")
/* appliation initialization (gui application etc ...) */
#define INIT_APP_EXPORT(fn) INIT_EXPORT(fn, "6")

extern void vhdl_board_init(void);

#endif
